/* 
描述：定义登录响应数据传输对象 
完成人：吴悠 
完成时间: 2025/04/27
*/
package com.jiesenhe.qacommunity.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.jiesenhe.qacommunity.pojo.User;

@JsonInclude(JsonInclude.Include.NON_NULL)  // 自动忽略值为 null 的字段
public class LoginResponseDTO {
    private Integer id;
    private String username;
    private String email;
    private String avatar;
    private Integer type;
    private String entrydate;
    private Integer age;
    private Integer gender;
    private String introduction;
    private String phone;
    private String token;
    private String nickname;

    // 通过构造函数或 Setter 从 User 对象复制数据
    public LoginResponseDTO(User user) {
        this.id = user.getId();
        this.username = user.getUsername();
        this.email = user.getEmail();
        this.avatar = user.getAvatar();
        this.type = user.getType();
        this.entrydate = user.getEntrydate();
        this.age = user.getAge();
        this.gender = user.getGender();
        this.introduction = user.getIntroduction();
        this.phone = user.getPhone();
        this.token = user.getToken();
        this.nickname = user.getNickname();
    }

    // Getter 和 Setter
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }
}